package org.gp.core.web;

import com.alibaba.fastjson.JSON;
import org.gp.core.entity.dto.ResponseDTO;
import org.gp.core.service.IReasonSettingService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 原因配置表  前端控制器
 * </p>
 *
 * @author LuoLiang
 * @since 2017-06-04
 */
@RestController
@RequestMapping("/reasonSetting")
public class ReasonSettingController {
    @Resource
    private IReasonSettingService service;

    @RequestMapping(value = "list", method = RequestMethod.GET)
    public String list(String type) {
        ResponseDTO dto = service.list(type);

        return JSON.toJSONString(dto);
    }

    @RequestMapping(value = "save", method = RequestMethod.POST)
    public String save(String json, String type) {
        ResponseDTO dto = service.update(json, type);

        return JSON.toJSONString(dto);
    }
}
